Skip to content

Conversation

@kgram
Copy link

@kgram kgram commented Oct 9, 2024

Adds support for rspack by optionally providing access to html-plugin hooks through options.

The new option, HtmlPlugin, defaults to the peer-dependency html-webpack-plugin, but will not fail until the plugin runs if absent. rspack.HtmlRspackPlugin can then be supplied instead.

All tests pass (NODE_OPTIONS=--openssl-legacy-provider was necessary for webpack 4, though), and a new end to end test suite has been added for rspack.

There are a few notable changes that was necessary to make this run:

  • excludeHtmlNames/includeHtmlNames now runs on outputName instead of plugin.options.filename, since rspacks html-plugin doesn't reliably provide raw plugin data in hooks. I believe this is the more correct option to use, but it may be a breaking change in some niche situations.
  • Extracting parent chunk name has been slightly modified to avoid hard-coded references to webpack.

Testing has been modified to fit this new option:

  • Pass the new HtmlPlugin option
  • Set compiler.outputFileSystem before running compiler
  • Handle non-string compilation errors
  • Async chunk fixture should use import() instead of require.ensure
  • Minor differences with rspack source map generation and output casing

Lock-file has been completely updated, since yarn seems to have changed their download URLs since it was last run.

@kgram kgram mentioned this pull request Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant